[Differ] Remove ConsoleDiffer, use DefaultDiffer that utilize ColorConsoleDiffFormatter instead to avoid double diffing process#7309
Conversation
…nsoleDiffFormatter instead to avoid double diffing process fix cs
|
All checks have passed 🎉 @TomasVotruba it is ready for review. |
…d by phpstan if any issue
|
my intial motivation for this change was performance. did you check whether this new implementation is faster then the previous one? |
|
Not yet check on a large diff. The check may need a large diff on a single run to see comparison, yes? |
|
IIRC the reproducer is described in rectorphp/rector#7899 |
|
I tried that, seems 1 second faster: Before After |
|
Updated stop loop on found --- Original and +++ New, got new result: Before After |
|
@samsonasik What are numbers on one if our private client's project? Real projects are better than Rector itself |
|
@TomasVotruba yes, the measure is depends on how many files changed, more diffs, more faster. I tried in our project with 70 files changed, that means there are diffs, it 3 seconds faster. Before After |
|
@TomasVotruba I've updated with reduce loop, remove array_map, and it seems faster 7 seconds now, applied 70 files changes, tested on our project: Before 2:05.41 After 1:58.40 |
|
Let's give it a try 👍 |
|
This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work. |
@staabm this is the rework effort from the old PR:
I tested with diff on json format, it keep same, see https://www.diffchecker.com/YtVb6oKF/
The process is:
DefaultDiffer->diff()as default valueFileDiff::__construct()ondiffConsoleFormatted, it calllike this:
Then, to keep the string
@@ @@, I use regex onColorConsoleDiffFormatter->diff().